Documentation

inbox/UI Retrofit Inventory.md


title: UI Retrofit Inventory (Legacy AssetTrak -> New Backend)
date: 2025-01-XX
scope: draft
sources:

  • docs/archive/2025-11-04-ui-kiota-audit.md
  • components/assettrak-ui/src/acsis-assettrak-ui/services/*.ts
  • components/assettrak-ui/src/acsis-assettrak-ui/pages/**/*

UI Retrofit Inventory (Legacy AssetTrak -> New Backend)

This inventory reframes the migration by refactor category instead of page-by-page. It collects the most visible gaps from the UI service layer and spot-checks in pages. The list is intentionally incomplete until we validate backend coverage against the new APIs and review commented-out legacy implementations for reuse.

Permission System (Current Intended Behavior)

  • Every component exposes a permission manifest via /.well-known/permissions (see components/*/*Permissions.cs).
  • The Identity component discovers permissions at startup via PermissionSyncBackgroundService (10s delay) and stores them in Identity DB.
  • Discovery relies on Aspire service discovery; the AppHost must call WithReference() for each component so Identity can resolve https+http://{component}.
  • Manual resync is available via POST /permissions/sync.
  • UI should use session.user.permissions (hierarchical permission strings like catalog:items:read) and not legacy menu names.

Category A: Missing/Disabled API Endpoints

Area UI usage Expected endpoint Notes
Spatial locations services/location.service.ts GET /locations/{id}/tree (hierarchy) Still required. Only “same-tree” check exists today; UI needs full hierarchy tree.
Spatial locations services/location.service.ts POST /locations/importer Required; importer refactor per FA.1.
Spatial locations services/location.service.ts GET /locations/{id}/country Required; likely proxy using location countryId.
Catalog items (assets) services/assets.service.ts POST /items Required (FA.2). UI terminology still says asset/asset type/asset category.
Catalog items (assets) services/assets.service.ts PATCH /items/{id} Required (FA.2). UI terminology still says asset/asset type/asset category.
Catalog items (assets) services/common.service.ts GET /items/containers/search Needed but unclear container identification rules; requires design decision.
Catalog item attributes services/assets.service.ts GET /items/{id}/attributes Required; served by Prism attributes (FA.3).
Catalog item attributes services/assets.service.ts PUT /items/{id}/attributes Required; served by Prism attributes (FA.3).
Catalog item types services/assettypes.service.ts GET /item-types/{id}/attributes Required; served by Prism attributes (FA.3).
Catalog item types services/assettypes.service.ts POST /item-types/{id}/attributes Required; served by Prism attributes (FA.3).
Catalog attributes services/assettypes.service.ts POST /attributes/importer Required; Prisma attribute importer per FA.3/FA.1.
Catalog item import services/assets.service.ts POST /items/importer Required; importer refactor per FA.1.
Catalog tag import services/assets.service.ts POST /tags/importer Required; importer refactor per FA.1.
Workflow runs (process records) services/assets.service.ts GET /workflow-runs/{runId} Now exists in Workflow API; verify UI is using it and remove from backlog if confirmed.

Category B: Legacy UI Fields/DTOs That No Longer Exist

  • components/assettrak-ui/src/acsis-assettrak-ui/pages/locations/[id]/view.js: legacy fields should be removed; no backwards compatibility needed.
  • components/assettrak-ui/src/acsis-assettrak-ui/services/dashboard.service.ts: ItemSearchByModuleResult is insufficient and poorly named; replace with a better API/DTO that includes recency (e.g., lastUpdated) or a dedicated dashboard endpoint.
  • components/assettrak-ui/src/acsis-assettrak-ui/pages/locations/[id]/edit.js: remove legacy dual-field handling; use single GUID-based shape.
  • components/assettrak-ui/src/acsis-assettrak-ui/pages/assets/[id]/view.tsx: manually maps new field names (parentItemId, itemTypeName, statusName, etc.), implying more legacy field references likely remain elsewhere.
  • components/assettrak-ui/src/acsis-assettrak-ui/lib/permissionHelpers.ts: legacy permission-to-menu mapping exists; remove and rely on permission manifests + session.user.permissions only (see Permission System section).

Category C: Legacy Response/Shape Adapters (UI-side shims)

These are intentional compatibility layers but should be removed. The UI should talk directly to the new backend without legacy shims.

  • components/assettrak-ui/src/acsis-assettrak-ui/services/pack.service.ts: maps PackItemsDraft results to legacy shape (assetID, parentAssetID, etc.).
  • components/assettrak-ui/src/acsis-assettrak-ui/services/location.service.ts: adds countryCode from isoAlpha2 to match legacy UI expectations.
  • components/assettrak-ui/src/acsis-assettrak-ui/services/unpack.service.ts: transforms responses to legacy format.
  • components/assettrak-ui/src/acsis-assettrak-ui/services/pack.service.ts: converts legacy request fields to new API model.
  • Multiple pages still expect axios-style response.status/response.data instead of direct Kiota models (see archived audit).

Recent Reassessment (Location + Workflow)

  • Location create/update endpoints exist and are now used by the UI (CreateLocationRequest, UpdateLocationRequest).
  • Location valid parent lookup and workflow association endpoints exist and are now used by the UI:
    • GET /locations/{id}/valid-parents
    • GET /locations/{id}/workflows (backed by GET /workflows/by-location/{locationId})
  • Remaining location gaps are the full hierarchy endpoint and country lookup proxy.

Category D: Feature-Level Migrations (Case-by-Case)

  • Prism attribute system: use Prism for item attributes only (platform type id set to item in UI), while remaining open to other entities later.
  • Shipping/receiving: large migration area; requires deep review of rules and current UI logic.
  • Location hierarchy: keep hierarchy endpoint for UI tree view; separate from “same-tree” check.
  • Importers: per FA.1, split reusable importer logic into importer library and entity-specific mapping into each component.
  • Container search: needs definition of what qualifies as a container in the new model before endpoint implementation.

Category E: ID and Response Format Migration

  • The system now uses GUID primary keys (except some reference data). Update UI to use GUIDs consistently.
  • File service helpers (services/common.service.ts) coerce IDs to numbers; update for GUID file IDs.
  • Remove any legacy dual-format handling; locations use GUID primary keys.

Next Validation Pass (Backend Cross-Check)

  1. Confirm which endpoints actually exist in the new backend (components/<domain>/src) vs only in generated clients.
  2. Identify where Prism attribute endpoints live and map the UI features to the new API surface.
  3. Decide which legacy endpoints should be restored (short-term), replaced (medium-term), or removed from the UI (long-term).
  4. Update this inventory with an explicit status per item (Blocked / In Progress / Deprecated).

Permission Cleanup Work (Required)

  1. Remove legacy menu mapping in components/assettrak-ui/src/acsis-assettrak-ui/lib/permissionHelpers.ts and use session.user.permissions exclusively.
  2. Verify AppHost uses WithPermissionDiscovery() for Identity (which applies WithReference() to all registered components).
    • Present in projects/assettrak-classic/src/Acsis.Dynaplex.Projects.AssetTrakClassic/AppHost.cs.
    • Present in projects/bbu-rfid/src/Acsis.Dynaplex.Projects.BbuRfid/AppHost.cs.
    • Missing in projects/ghana-nets/src/Acsis.Dynaplex.Projects.GhanaNets/AppHost.cs (lower priority unless GhanaNets becomes the active AppHost).
    • Current testing target is projects/bbu-rfid/src/Acsis.Dynaplex.Projects.BbuRfid/AppHost.cs; prioritize fixes that affect this AppHost first.
  3. Add missing permission manifest classes (even if empty) for components that currently expose none but participate in AssetTrakClassic:
    • components/prism/src/Acsis.Dynaplex.Engines.Prism/PrismPermissions.cs
    • components/importer/src/Acsis.Dynaplex.Engines.Importer/ImporterPermissions.cs
    • components/file-handling/src/Acsis.Dynaplex.Engines.FileHandling/FileHandlingPermissions.cs
    • components/printing/src/Acsis.Dynaplex.Engines.Printing/PrintingPermissions.cs
    • components/intelligence/src/Acsis.Dynaplex.Engines.Intelligence/IntelligencePermissions.cs
  4. Confirm all components use AddServiceDefaults() so MapPermissionDiscoveryEndpoint() is wired (already present in each components/*/Program.cs).
  5. Validate startup sync works (Identity logs + POST /permissions/sync) before removing any UI fallbacks.